
<div class="right-sidebar-con">

    <div class="right-sidebar-main">
        <div class="right-sidebar-panel">
            <div id="quick-links" class="quick-links">
                <ul>
                    <li class="quick-area quick-login">
                        <a class="quick-links-a"><i class="setting"></i></a>
                        <div class="sidebar-user quick-sidebar">
                            <i class="arrow-right"></i>
                            <div class="sidebar-user-info">

                                <if condition='$Think.session.user_id neq null'>
                                    <div class="user-pic">
                                        <div class="user-pic-mask"></div>
                                        <img src="{$Think.session.user_auth.user_avatar}">
                                    </div>
                                    <p>你好！{$Think.session.user_auth.user_name}</p>
                                    <p>
                                        <a href="{:U('User/index')}" class="quick-login-a main-color">个人中心</a>|
                                        <a href="javaScript:out()" class="main-color">退出登陆</a>
                                    </p>
                                    <else />
                                    <div class="user-pic">
                                        <div class="user-pic-mask"></div>
                                        <img src="__IMG__/home/app.jpg">
                                    </div>
                                    <p>你好！请
                                        <a href="#" class="quick-login-a main-color">登录</a>|
                                        <a href="#" class="main-color">注册</a>
                                    </p>
                                </if>

                            </div>
                        </div>
                    </li>
                    <li class="sidebar-tabs">
                        <a href="#" class="mpbtn_bonus quick-links-a"><i class="bonus"></i></a>
                        <div class="popup">
                            <font>领红包再购物</font>
                        </div>
                    </li>
                    <li class="sidebar-tabs">
                        <div class="cart-list quick-links-a" id="collectBox">
                            <i class="cart"></i>
                            <div class="span">购物车</div>
                            <span class="ECS_CARTINFO">
                                <form id="formCart" name="formCart" method="post" action="flow.php">
                                    <span class="cart_num">{$cartNum}</span>
                                    <div class="sidebar-cart-box">
                                        <h3 class="sidebar-panel-header">
                                            <a href="#" class="title"><i class="cart-icon"></i><em class="title">购物车</em></a>
                                            <span class="close-panel"></span>
                                        </h3>
                                    </div>
                                </form>
                            </span>
                        </div>
                    </li>
                    <li class="sidebar-tabs">
                        <a href="#" class="mpbtn_history quick-links-a"><i class="history"></i></a>
                        <div class="popup">
                            <font id="mpbtn_histroy">我的足迹</font>
                        </div>
                    </li>
                    <li>
                        <a href="{:U('Favorites/index')}" target="_blank" class="mpbtn_stores quick-links-a"><i class="stores"></i></a>
                        <div class="popup">
                            我关注的店铺
                        </div>
                    </li>
                    <li id="collectGoods">
                        <a href="{:U('Favorites/index')}" target="_blank" class="mpbtn_collect quick-links-a"><i class="collect"></i></a>
                        <div class="popup">
                            我的收藏
                        </div>
                    </li>
                </ul>
            </div>
            <div class="quick-toggle">
                <ul>
                    <li class="quick-area QQbtn">
                        <a class="quick-links-a" target="_blank" href="tencent://message/?uin=1141994151&Site=&menu=yes">
                            <i class="customer-service"></i></a>
                        <div class="popup">QQ客服</div>
                    </li>
                    <li class="quick-area">
                        <a class="quick-links-a" href="#">
                            <i class="customer-contact"></i></a>
                        <div class="popup">400-0371-775</div>
                    </li>
                    <li class="quick-area">
                        <a class="quick-links-a" href="#"><i class="qr-code"></i></a>
                        <div class="sidebar-code quick-sidebar">
                            <i class="arrow-right"></i>
                            <img src="__IMG__/home/weixin.jpg">
                        </div>
                    </li>
                    <li class="returnTop">
                        <a href="#" class="return_top quick-links-a"><i class="top"></i></a>
                        <div class="popup">返回顶部<i class="arrow-right"></i>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <include file="Public/alert_login" />
        <div>
            <div class="right-sidebar-panels">
                <h3 class="sidebar-panel-header">
                    <a href="{:U('Coupons/index')}" class="title"><i class="bonus-icon"></i><em class="title">购物券</em></a>
                    <span class="close-panel"></span>
                </h3>
                <if condition="$p_voucher">
                    <div class="bonus-panel-main">
                        <foreach name="p_voucher" item="v">
                            <div class="bonus-panel-content">
                                <div class="bonus-list">
                                    <div class="stamp stamp00">
                                        <b class="stamp_left"></b>
                                        <b class="stamp_right"></b>
                                        <div class="par">
                                            <p>{$v['voucher_storename']}</p><sub class="sign">￥</sub><span>{$v['voucher_price']}</span><sub>优惠券</sub>
                                            <p>订单满{$v['voucher_limit']}元</p>
                                        </div>
                                        <div class="copy">副券
                                            <p>{$v['voucher_start_date']|date="Y-m-d H:i:s",###}<br>{$v['voucher_end_date']|date="Y-m-d H:i:s",###}</p>
                                        </div>
                                        <i></i>
                                    </div>
                                </div>
                            </div>
                        </foreach>
                    </div>
                    <else />
                    <div class="tip-box">
                        <i class="tip-icon"></i>
                        <div class="tip-text">您还没有领取任何购物券<br>
                            <a class="main-color" href="{:U('Coupons/index')}">点击我去领取</a>
                        </div>
                    </div>
                </if>

            </div>

            <div class="ECS_CARTINFO right-sidebar-panels">
                <form id="formCart" name="formCart" method="post" action="flow.php">
                    <span class="cart_num">{$cartNum}</span>
                    <div class="sidebar-cart-box">
                        <h3 class="sidebar-panel-header">
                            <a href="{:U('Cart/index')}" class="title">
                                <i class="cart-icon"></i>
                                <em class="title">购物车</em></a>
                            <span class="close-panel"></span>
                        </h3>
                        <div class="cart-panel-main">
                            <div class="cart-panel-content" style="height: 851px;">
                                <?php  $user_id =session('user_id'); if(empty($user_id)){ ?>
                                    <div class="tip-box">
                                    <i class="tip-icon"></i>
                                    <div class="tip-text">您的购物车里什么都没有哦<br>
                                    <a class="main-color" href="' . HOME_URL . '">再去看看吧</a>
                                    </div>
                                    </div>
                                <?php }else{ ?>
                                <!-- 提取购物车 -->
                                <script type="text/javascript">
                                    $(document).ready(function () {
                                        $.post("{:U('/Trader/reloadCart')}", function (result) {
                                            $(".cart-panel-content").html(result);
                                        });
                                    });
                                </script>
                                <?php }?>
                            </div>
                        </div>
                    </div>
                </form>
                <script>
                    $('#myform').layer({});
                </script>
            </div>

            <div class="right-sidebar-panels">
                <h3 class="sidebar-panel-header">
                    <a href="#" class="title"><i></i><em class="title">我的足迹</em></a>
                    <span class="close-panel"></span>
                </h3>
                <div class="sidebar-panel-main">
                    <div class="sidebar-panel-content">
                        <if condition="session('user_id')">
                            <div class="history-panel">
                                <ul>
                                    <foreach name="goods_browse" item="v">
                                        <li>
                                            <div class="p-img">
                                                <a target="_blank" href="{:HOME_URL}/Goods/{$v['goods_id']}"><img src="{$v['goods_thumb']}" alt="{$v['goods_title']}"></a>
                                            </div>
                                            <div class="p-name">
                                                <a target="_blank" href="{:HOME_URL}/Goods/{$v['goods_id']}">{$v['goods_title']}</a>
                                            </div>
                                            <div class="p-comm"><span class="p-price main-color">￥{$v['goods_price']}</span> </div>
                                        </li>
                                    </foreach>
                                </ul>
                            </div>
                            <else />
                            <div class="tip-box">
                                <i class="tip-icon"></i>
                                <div class="tip-text">登陆可帮您保存记录哦<br>
                                    <a class="main-color" href="{:U('Login/index')}">现在登陆</a>
                                </div>
                            </div>
                        </if>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function Specifications() { //选择规格是否满足
        var i = 0;
        var o = $("#choose .catt");
        var d = new Array();
        o.each(function () {
            if ($(this).attr("data-attrval")) {
                i++;
                d.push($(this).attr("data-attrval"));
            }
        })
        d.push($("#number").val());
        if (!(o.length == i)) {
            o.eq(0).parents("#choose").addClass("choose_bor_bor");
            return false;
        } else {
            o.eq(0).parents("#choose").removeClass("choose_bor_bor");
            return d;
        }
    }
    //点击用户图标弹出登录框
var Signin = <?php $user_id =session('user_id'); echo empty($user_id) ? 0 : $user_id; ?>;
function deleteCartGoods(obj, dete) {
    dete = {goods_id: dete};
    var a = Aajax(homeUrl + "/Cart/del", dete);
    if (a.p) { //状态
        $(".cart_num").text(a.n); //数量
        result = Aajax("/Trader/reloadCart");
        $(".cart-panel-content").html(result);
        layer.msg('商品已移出购物车！');
    }else{
        layer.msg('移出购物车失败！');
    }
}
$('.quick-login,quick-login-a').click(function() { //点击登录头像
    if (!Sign()) {
        return false;
    }
})
$('.quick-area').hover(function() {
    $(this).find('.quick-sidebar').show();
},function() {
    $(this).find('.quick-sidebar').hide();
})
//移动图标出现文字
$(".right-sidebar-panel li").mouseenter(function() {
    $(this).children(".popup").stop().animate({
        right: 35,
        queue: true
    });
    $(this).children(".popup").css({
        "visibility": "visible",
        "background-color": "#f43e83"
    });
    $(this).children(".ibar_login_box").css("display", "block");
});
$(".right-sidebar-panel li").mouseleave(function() {
    $(this).children(".popup").stop().animate({
        right: -70,
        queue: true
    });
    $(this).children(".popup").css({
        "visibility": "visible",
        "background-color": "#4b4b4b"
    });
    $(this).children(".ibar_login_box").css("display", "none");
});
//点击购物车、用户信息以及浏览历史事件
$('.sidebar-tabs').click(function() {
    if ($('.right-sidebar-con').hasClass('right-sidebar-main-open') && $(this).hasClass('current')) {
        $('.right-sidebar-con').removeClass('right-sidebar-main-open').addClass('right-sidebar-main-shut');
        $(this).removeClass('current');
    } else {
        $(this).addClass('current').siblings('.sidebar-tabs').removeClass('current');
        $('.right-sidebar-con').addClass('right-sidebar-main-open').removeClass('right-sidebar-main-shut');
        $('.right-sidebar-panels').eq($(this).index() - 1).css('z-index', 6).siblings('.right-sidebar-panels').css('z-index', 5);
    }
});
$(".right-sidebar-panels").on('click', '.close-panel',function() {
    $('.sidebar-tabs').removeClass('current');
    $('.right-sidebar-con').removeClass('right-sidebar-main-open');
    $('.right-sidebar-panels').removeClass('animate-out');
});
$(window).resize(function(){
   resize();
});
resize();
function resize(){
	$(".cart-panel-content").css("height",gettop().h-40+"px");
}
</script>
